import request from '@/utils/request'

// 获取用户薪资列表
export function getSalarysList(data) {
  return request({
    url: '/salarys/list',
    data,
    method: 'post'
  })
}

// 查询用户薪资
export function getSalaryDetail(userId) {
  return request({
    url: `/salarys/modify/${userId}`
  })
}

// 调薪
export function changeSalary(data) {
  return request({
    url: `/salarys/modify/${data.userId}`,
    method: 'post',
    data
  })
}

// 定薪
export function fixedSalary(data) {
  return request({
    url: `/salarys/init/${data.userId}`,
    method: 'post',
    data
  })
}

// 获取企业计薪及津贴设置
export function getSalarysSetting() {
  return request({
    url: `/salarys/settings`
  })
}

// 获取企业是否设置当月工资
export function getCompanySetting() {
  return request({
    url: '/salarys/company-settings'
  })
}

// 获取企业计薪和津贴
export function getSettings() {
  return request({
    url: '/salarys/settings'
  })
}

// 保存企业计薪和津贴
export function saveSettings(data) {
  return request({
    url: '/salarys/settings',
    method: 'post', data
  })
}

// 根据年月查询企业用户薪资列表
export function getArchivingCont(params) {
  return request({
    url: `/salarys/reports/${params.yearMonth}`,
    params
  })
}

// 新建报表
export function newReport(data) {
  return request({
    url: `/salarys/reports/${data.yearMonth}/newReport`,
    method: 'put',
    data
  })
}
